package com.bigtomato.tomatochat.server.impl;


import com.bigtomato.tomatochat.dao.UserDao;
import com.bigtomato.tomatochat.entity.User;
import com.bigtomato.tomatochat.server.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    UserDao userDao;

    public boolean isExistUsername(String username) {
        return userDao.isExistUsername(username);
    }

    @Override
    public boolean userLogin(User user) {
        return userDao.userLogin(user);
    }

    @Override
    public Map userRegister(User user) {
        Map message=userDao.addUser(user.getUsername(),user.getPassword());
        return message;
    }

    @Override
    public Map getRandAccount() {
        return userDao.addRandUser();
    }
}
